package com.quanjiaolian.tools;

import java.util.ResourceBundle;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import org.apache.log4j.Logger;

import com.quanjiaolian.order.service.OrderService;
import com.quanjiaolian.order.serviceimpl.OrderServiceImpl;

public class TimeTask {
	/**
	 * 声明Log4j变量
	 */
	public static ResourceBundle resourceBundle = null;
	static Logger logger = Logger.getLogger(TimeTask.class.getName());
	
	public static void start(){
		Runnable runnable = new Runnable(){
			OrderService os = new OrderServiceImpl();
			public void run(){
				logger.info("********************定时任务开始执行!********************");
				os.makeOrderFailed();
				logger.info("********************定时任务执行完毕!********************");
			}
		};
		ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
		service.scheduleAtFixedRate(runnable,0,60*5,TimeUnit.SECONDS);
	}
	
}
